 /*
 * @description: 店铺数据/查看售后订单
 * @Author: along
 * @Date: 2021-05-24
 * @Last Modified by: along
 * @Last Modified time: 2021-05-27
 */
<template>
    <el-dialog
        title="售后订单"
        :visible.sync="dialogVisible"
        width="348px"
        :close-on-click-modal="false"
        class="__model"
    >
        <div class="__table">
            <el-table
                :data="tableData"
                height="100%"
                style="width: 100%"
                class="data-table"
            >
                <el-table-column
                    prop="status"
                    label="售后类型"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="center"
                >
                    <template slot-scope="scope">
                        {{ scope.row.status | filterType }}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="count"
                    label="售后成功订单数"
                    show-overflow-tooltip
                    :formatter="emptyFormatter"
                    align="center"
                />
            </el-table>
        </div>
        <p class="__desc">
            说明：售后成功订单数为统计统计该订单的商品发起并售后成功的订单数量。如果同一个订单里的商品A和商品B发起售后，商品A发起退货退款，商家同意退货退款，商品B发起换货，商家同意换货，那么退货退款订单数量+1，换货订单数量为+1；
        </p>
    </el-dialog>
</template>

<script>
export default {
    name: 'CheckSaleOrder',
    filters: {
        filterType (val) {
            if(val === 1) return '仅退款';
            if(val === 2) return '退货退款';
            if(val === 3) return '换货';
            return '--';
        }
    },
    data () {
        return {
            dialogVisible: false,
            tableData: []
        };
    },
    methods: {
        /**
         * @description 显示弹窗
         */
        show (row) {
            this.tableData = [{
                status: 1,
                count: row.refund_count
            },{
                status: 2,
                count: row.refund_and_reject_goods_count
            },{
                status: 3,
                count: row.change_goods_count
            }];
            this.dialogVisible = true;
        },

        /**
         * @description 关闭弹窗
         */
        close () {
            this.dialogVisible = false;
        },

        /**
         * @description 过滤函数
         */
        emptyFormatter(row, column, val) {
            if (!val) return '--';
            return val;
        }
    }
};
</script>

<style lang="less" scoped>
.__table {
    width: 100%;
    max-height: 424px;
    overflow: hidden;
    overflow-y: auto;
    box-sizing: border-box;
    border-left: 1px solid #EBEEF5;
    border-right: 1px solid #EBEEF5;
}
.__desc {
    font-size: 12px;
    line-height: 22px;
    margin: 14px 0px 0 0px;
}
.pagination-wrapper {
    padding: 0px 24px;
    border: 1px solid #EBEEF5;
    display: flex;
    align-items: center;
    height: 56px;
    border-top: none;
    justify-content: flex-end;
    .el-pagination {
        float: right;
        padding: 0;
        background-color: transparent;
    }
}
</style>